package com.lingshi.yingzaitownmap.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lingshi.yingzaitownmap.entity.domain.Attraction;
import com.lingshi.yingzaitownmap.entity.dto.AttractionPageQueryDTO;
import com.lingshi.yingzaitownmap.entity.result.PageResult;
import com.lingshi.yingzaitownmap.service.AttractionService;
import com.lingshi.yingzaitownmap.mapper.AttractionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 刘瑞鹏
* @description 针对表【scenic_spots(景点表)】的数据库操作Service实现
* @createDate 2025-06-28 13:32:29
*/
@Service
public class AttractionServiceImpl extends ServiceImpl<AttractionMapper, Attraction>
    implements AttractionService {
    @Autowired
    private AttractionMapper attractionMapper;


    @Override
    public PageResult list(AttractionPageQueryDTO attractionPageQueryDTO) {
        PageHelper.startPage(attractionPageQueryDTO.getPage(),attractionPageQueryDTO.getPageSize());
        Page<Attraction> p =attractionMapper.list(attractionPageQueryDTO);
        PageResult pageResult = new PageResult(p.getTotal(),p.getResult());
        return pageResult;
    }

    @Override
    public Object getbyId(Integer id) {
        Attraction info = attractionMapper.getbyId(id);
        return info;
    }
}




